package Test;

import Ctr.LoginCtr;
import Model.Student;
import Model.Teacher;
import org.junit.Assert;
import org.junit.Test;

import static junit.framework.Assert.fail;

public class LoginCtrTest {
    //ok
    @Test
    public void testTeacherLogin() throws Exception {
        LoginCtr loginCtr = new LoginCtr();
        String userName = "kbha@ucn.dk";
        String password = "kbha123";
        Teacher teacher = loginCtr.teacherLogin(userName, password);

        if (teacher != null) {
            System.out.println(teacher.getId());
            System.out.println(teacher.getName());
            System.out.println(teacher.getUsername());
            System.out.println(teacher.getPassword());
            System.out.println(teacher.getAddress());
            System.out.println(teacher.getEmail());
            System.out.println(teacher.getPhoneNo());
            System.out.println(teacher.getType());
            System.out.println(teacher.getTeacherId());
            System.out.println(teacher.getInitials());
        }
        else {
            fail("Failed finding teacher - teacher is null");
        }
    }
    //ok
    @Test
    public void testStudentLogin() throws Exception {
       LoginCtr loginCtr = new LoginCtr();
        String userName = "1026895";
        String password = "kodeord";
        Student student = loginCtr.studentLogin(userName, password);

        if (student != null) {
            System.out.println(student.getId());
            System.out.println(student.getName());
            System.out.println(student.getUsername());
            System.out.println(student.getPassword());
            System.out.println(student.getAddress());
            System.out.println(student.getEmail());
            System.out.println(student.getPhoneNo());
            System.out.println(student.getType());
            System.out.println(student.getStudentId());
            System.out.println(student.getStudentNo());
            System.out.println(student.getTeamId().getName());
        }
        else {
            Assert.fail("Failed finding student - student is null");
        }
    }
}
